<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/9/10
  Time: 16:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>管理员管理首页</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/roleManagement.css">
    <script src="${pageContext.request.contextPath}/static/jquery/jquery-3.1.1.js"></script>
    <script src="${pageContext.request.contextPath}/static/jquery/jquery.validate.js"></script>
    <link rel="stylesheet" href="/static/frame/layui/css/layui.css">
    <link rel="stylesheet" href="/static/frame/static/css/style.css">
    <link rel="icon" href="/static/frame/static/image/code.png">

    <style>
        .showmessages{
            position: absolute;
            width: 100%;height: 100%;
            margin-top: 100px;
        }
    </style>
</head>
<body>
<div class="pageall">
    <div class="backphall">
        <div class="titleall">
            <div class="titleph">
                <img src="${pageContext.request.contextPath}/static/images/house.png" style="width:100%;height:100%;"/>
            </div>
            <div class="titleword">管理员管理 >>> 管理员列表</div>
        </div>
        <form action="selectAdmin" method="post" id="selectform">
            <input type="text" class="selectbox" name="admin_username" placeholder="管理员账号 / Name"/>
            <input type="submit"  value="查询" class="selectbutton"/>
        </form>
        <div class="contentall"></div>
    </div>
    <div class="showmessages">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col width="150">
                <col width="200">
                <col>
            </colgroup>
            <thead>
            <tr>
                <th style="width: 60px;"><input type="checkbox"></th>
                <th>管理员ID</th>
                <th>管理员账号</th>
                <th>姓名</th>
                <th>电话</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${admin2}" var="o">
            <form action="deleteAdminController.do" method="post">
                <tr>
                    <td style="width: 60px"><input type="checkbox"></td>
                    <td>${o.getAdmin_id()}<input type="hidden" name="admin_id" value="${o.getAdmin_id()}"></td>
                    <td>${o.getAdmin_username()}<input type="hidden" name="admin_username" value="${o.getAdmin_username()}"></td>
                    <td>${o.getAdmin_name()}<input type="hidden" name="admin_name" value="${o.getAdmin_name()}"></td>
                    <td>${o.getAdmin_phone()}<input type="hidden" name="admin_phone" value="${o.getAdmin_phone()}"></td>
                    <td>${o.getAdmin_status()}<input type="hidden" name="admin_status" value="${o.getAdmin_status()}"></td>
                    <td>${o.getAdmin_createtime()}<input type="hidden" name="admin_createtime" value="${o.getAdmin_createtime()}"></td>
                    <td>
                        <div style="width: 60px;height: 30px;background-color: deepskyblue;line-height: 30px;float: left;text-align: center" onclick="window.location.href='${pageContext.request.contextPath}/adminUpdate'">修改</div>&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="submit" name="buttonValue" value="删除"  style="width: 60px;height: 30px;background-color: indianred;border: 0px">
                    </td>
                </tr>
            </form>
            </c:forEach>
            </tbody>
        </table>
        <div style="width: 100%;height: 30px;line-height: 30px">
                <div id="pageButton1" href="#" style="width:60px;height:30px;float: left;text-align: center;border: solid 1px gray">上一页</div>
                <div class="a" href="#" style="width:30px;height:30px;float: left;text-align: center;border: solid 1px gray">1</div>
                <div class="a" href="#" style="width:30px;height:30px;float: left;text-align: center;border: solid 1px gray">2</div>
                <div class="a" href="#" style="width:30px;height:30px;float: left;text-align: center;border: solid 1px gray">3</div>
                <div class="a" href="#" style="width:30px;height:30px;float: left;text-align: center;border: solid 1px gray">4</div>
                <div id="pageButton2" href="#" style="width:60px;height:30px;float: left;text-align: center;border: solid 1px gray">下一页</div>
        </div>

    </div>

</div>

</body>
<script>
    var i=0;
    var w=$(window).width();
    var h=$(window).height();
    $(".pageall").innerHeight(h+"px");
    $(".pageall").innerWidth(w+"px");

    /**
     * 分页操作
     */
    showPage(this);
    function showPage(e) {
        var counts="${requestScope.counts}";//从后台获取查询到的所有管理员的个数
        <%--var pageButton1=document.getElementById("pageButton1");--%>
        <%--var pageButton2=document.getElementById("pageButton2");--%>
        <%--var test=document.getElementById("test");--%>
        <%--var pages=document.getElementsByClassName("a");--%>
        $(".a").css({"display":"none"});
        $("#pageButton1").css({"display":"none","cursor":"pointer"});
        $("#pageButton2").css({"display":"none","cursor":"pointer"});
        var num=counts/6;
        var as=$(".a");
        $.each(as,function (i,v) {
            if(i<num){
                $(v).css({"display":"block","cursor":"pointer"});
                $("#pageButton1").css("display","block");
                $("#pageButton2").css("display","block");
            }
            if (i==0){
                $(v).css("background","green")
            }
        })

    }
</script>

</html>
